public class Ifelse {
    public static void main(String[] args){
        //基础if-else示例
        int number = 10;
        if (number > 0) {
            System.out.println("正数");
        }else if (number < 0){
            System.out.println("负数");
        }else {
            System.out.println("零");
        }

        // 嵌套if示例
        int score = 100;
        if (score >= 95) {
            System.out.println("优秀");
        } else if (score >= 90) {
            System.out.println("良好");
        } else if (score >= 60) {
            System.out.println("及格");
        } else {
            System.out.println("不及格");
        }

        // 逻辑运算符结合
        int x = 50;
        if (x >= 0 && x <= 100) {
            System.out.println("在有效范围内");
        } else {
            System.out.println("超出范围");
        }

        // 三元运算符示例
        int a = -7;
        int absValue = (a >= 0) ? a : -a;
        System.out.println("绝对值: " + absValue);
    }
}
